package com.example.diagnose.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.diagnose.Domain.Article;
import com.example.diagnose.Mapper.ArticleMapper;
import com.example.diagnose.Service.ArticleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Resource
    Article article;

    @Resource
    ArticleMapper articleMapper;

    @Override
    public List<Article> getArticle() {
        return articleMapper.selectList(null);
    }

    @Override
    public Article getArticleById(int id) {
        QueryWrapper<Article> wrapper = new QueryWrapper<>();
        wrapper.eq("article_id", id);
        return articleMapper.selectOne(wrapper);
    }
}
